﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>

<h1>我的第一段 JavaScript</h1>

<p id="doc">
JavaScript 能改变 HTML 元素的内容。
</p>

<button type="button" onClick="user_a_click()">查看</button>

<p id="this-user">
</p>

<script>

count_1=null;
function myFunction()
{
	
	x=document.getElementById("doc");  // 找到元素
	if (count_1==0) {
	x.innerHTML="Hello JavaScript!";    // 改变内容
	count_1=1;
} else {
	x.innerHTML='WHAT THE FUCK';
	count_1=0;
}

}
</script>

<button type="button" onclick="myFunction()">点击这里</button>

<script>

function user_a_click() {
alert(TextShow)	;
}

var user_a=new Object; //用户对象
user_a.firstname="向";
user_a.lastname="涛";
user_a.age=32;
user_a.sex="男";



var TextShow="姓名："+user_a.firstname+user_a.lastname+"<br>性别："+user_a.sex+"<br>年龄："+user_a.age;

t=document.getElementById("this-user");//获取元素
t.innerHTML=TextShow;
</script>
<p id="info2">循环显示字符串</p>
<p id="test_echo"> </p>
<script>
var ThisTxt="xiangtao your a the best!!!!";
var count=0;
var count_index=ThisTxt.length;
var TxtShow=document.getElementById("test_echo");
var TxtString="";
for (count=0;count<count_index;count++){
	TxtString=TxtString+ThisTxt[count]+"<br>";
}

TxtShow.innerHTML=TxtString;

</script>
</body>
</html>